package com.hansming.bss.modules.sfc.dao;

import org.apache.ibatis.annotations.Param;

import com.hansming.bss.common.persistence.CrudDao;
import com.hansming.bss.common.persistence.annotation.MyBatisDao;
import com.hansming.bss.modules.sfc.entity.PcUser;

@MyBatisDao
public interface PcUserDao extends CrudDao<PcUser> {
	
	
	//储存用户
	public int savepcuser(PcUser pcuser);
		
	//用户添加token
	public PcUser checkpcusertoken(String userid);
	
	//检测是否在用户表存在该电话
	public int checkphone(@Param("phone")String phone);

	//检测是否在手机验证码表中存在此手机号
	public int checkcodephone(@Param("phone")String phone);
	
	//更新手机验证码
	public void updatephonecode(@Param("phone")String phone,@Param("code")String code,@Param("codetime")String codetime);
	
	//验证验证码
	public int checkphoneAndCode(@Param("phone")String phone,@Param("code")String code);
	
	//储存PC用户手机验证码与对应的储存时间
	public int	savephonecode(@Param("phone")String phone,@Param("code")String code,@Param("codetime")String codetime);
	
	//验证手机验证码得到手机验证码时间(这个方法得到的是时间，且不与PcUser同一张表
	public String selectPcUserByPhone(@Param("phone")String phone,@Param("code")String code);
	
	//根据电话和验证码返回用户对应的PC用户信息
	public PcUser selectPcUserByPhoneAndCode(@Param("phone")String phone,@Param("code")String code);
	
	//根据密码和电话登陆
	public PcUser selectPcUserByPhoneAndPassword(@Param("phone")String phone,@Param("password")String password);
	
	//修改密码根据电话号码
	public int updatepassworedbyphone(@Param("phone")String phone,@Param("password")String password);
	 
	//根据用户token查找用户
	public PcUser selectAllByToken(@Param("token")String token);
}
